package com.wy.powerbuilder.controller.Costs;

import com.github.pagehelper.PageInfo;

import com.wy.powerbuilder.entity.Costs.parking;
import com.wy.powerbuilder.entity.hxl.carseat;
import com.wy.powerbuilder.mapper.Costs.ParkingMapper;
import com.wy.powerbuilder.service.Costs.ParkingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class ParkingController {
    @Autowired
    private ParkingMapper parkingMapper;
    @Autowired
    private ParkingService parkingService;

  /*  @RequestMapping("/carseat")
    public String selCarseat(Model model){
        List<carseat> cars=parkingService.selCarSeat();
        model.addAttribute("cars",cars);
        return "product-category-add";
    }*/
    //查询
    @RequestMapping("selcarAll")
    public String selcarAll(Model model){
        List<carseat> list=parkingService.selCarSeat();
        model.addAttribute("list",list);
        return "parkingfee";
    }

    //根据id查
    @RequestMapping("/parkingInfo")
    public String selid(Integer id,Model model){
        List<parking> parkings=parkingService.selidall(id);
        model.addAttribute("parkings",parkings);
        return "product";
    }
    //查询
    @RequestMapping("/selcar")
    public String selcar(Model model,String housing){
        int selcar=parkingService.selcar(housing);
        model.addAttribute("selcar",selcar);
        return "forward:/addParking";
    }
    //id查询业主
    @RequestMapping("/selid")
    public String selcarid(Integer id,Model model){
        carseat selid=parkingService.selcarid(id);
        model.addAttribute("selid",selid);
        return "product-category-add";
    }
    //添加
    @RequestMapping("/addParking")
    public String addParking(parking parking,Model model){
        parkingService.addParking(parking);
        return "forward:/selcarAll";
    }
}
